<!DOCTYPE html>
<html>
<head>
  <title>domaku | anime.js</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
  <meta property="og:title" content="anime.js">
  <meta property="og:url" content="http://animejs.com">
  <meta property="og:description" content="Javascript Animation Engine">
  <meta property="og:image" content="http://animejs.com/documentation/assets/img/icons/og.png">
  <meta name="twitter:card" content="summary">
  <meta name="twitter:title" content="anime.js">
  <meta name="twitter:site" content="@juliangarnier">
  <meta name="twitter:description" content="Javascript Animation Engine">
  <meta name="twitter:image" content="http://animejs.com/documentation/assets/img/icons/twitter.png">
  <link rel="apple-touch-icon-precomposed" href="../assets/img/icons/apple-touch-icon.png">
  <link rel="icon" type="image/png" href="../assets/img/icons/favicon.png">
  <link href="../css/anime.css" rel="stylesheet">
  <script src="../js/anime.min.js"></script>
  <!-- <script src="../assets/js/anime.2.1.0.js"></script> -->
  <!-- <script src="../assets/js/anime.2.0.1.js"></script> -->
  <!-- <script src="../assets/js/anime.1.3.js"></script> -->
  <style>
    body {
      overflow: hidden;
      position: absolute;
      width: 100%;
      height: 100%;
    }
    .wrapper {
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;
      height: 100%;
    }
    .particule {
      position: absolute;
    }
  </style>
</head>
<body>
  <script>

    var numberOfEls = 1000;
    var duration = 1000;
    var midScreenX = window.innerWidth / 2;
    var midScreenY = window.innerHeight / 2;
    var radius = Math.sqrt(midScreenX * midScreenX + midScreenY * midScreenY);
    var fragment = document.createDocumentFragment();

    for (var i = 0; i < numberOfEls; i++) {
      var hue = Math.round(360 / numberOfEls * i);
      var angle = Math.random() * Math.PI * 2;
      var el = document.createElement('div');
      el.classList.add('particule');
      el.style.backgroundColor = 'hsl(' + hue + ', 40%, 60%)';
      el.style.width = '1px';
      el.style.height = '1px';
      anime({
        targets: el,
        width: ['1px', '20px'],
        height: ['1px', '20px'],
        left: [midScreenX + 'px', Math.cos(angle) * radius + midScreenX + 'px'],
        top: [midScreenY + 'px', Math.sin(angle) * radius + midScreenY + 'px'],
        delay: (duration / numberOfEls) * i,
        duration: duration,
        easing: 'easeInExpo',
        loop: true
      });
      fragment.appendChild(el);
    }

    document.body.appendChild(fragment);

  </script>
  <script src="../js/stats.js"></script>
</body>
</html>
